﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminSite.Master" AutoEventWireup="true" CodeBehind="ShowOrders.aspx.cs" Inherits="Agents.Admin.ShowOrders" %>
<asp:Content ID="Header" ContentPlaceHolderID="Header" runat="server">
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
	<h1>
		צפיה בהזמנות
	</h1>            
	<hr />       
	
	<asp:Panel ID="ordersPanel" runat="server" Height="300px" Width="100%" ScrollBars="Vertical"> 
		<asp:DataGrid runat="server" ID="dgOrders" AutoGenerateColumns="False"
			AllowPaging="True" PageSize="12" PagerStyle-Mode="NumericPages" 
			DataSourceID="SqlDataSource1" BackColor="White" BorderStyle="None" 
			CellPadding="3" GridLines="Both" 
			CssClass="dataGrid" Font-Names="Verdana" BorderColor="#999999" 
			BorderWidth="1px">
			<AlternatingItemStyle BackColor="#DCDCDC" />
			<Columns>
				<asp:BoundColumn DataField="OrderId" Visible="false" />
				<asp:BoundColumn DataField="ClientName" HeaderText="שם הלקוח" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" />
				<asp:BoundColumn DataField="AgentName" HeaderText="שם הסוכן" ItemStyle-Wrap="false" HeaderStyle-Wrap="false" />
				<asp:BoundColumn DataField="Date" HeaderText="תאריך" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
				<asp:BoundColumn DataField="Sum" HeaderText="סכום ההזמנה" ItemStyle-Wrap="false" HeaderStyle-Wrap="false"/>
			</Columns>
			<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
			<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
			<ItemStyle BackColor="White" ForeColor="Black" />
			<PagerStyle Mode="NumericPages" BackColor="#999999" ForeColor="Black" 
			HorizontalAlign="Center"></PagerStyle>
			<SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
		</asp:DataGrid>
		<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
			ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
			SelectCommand="SELECT	Orders.Id AS OrderId, Clients.Name AS ClientName, 
									Agents.Name AS AgentName, Date, Sum, Remarks
							FROM Orders LEFT JOIN Clients
							ON (Orders.ClientId = Clients.Id)
							LEFT JOIN Agents
							ON (Orders.AgentId = Agents.Id)
							WHERE convert(date, Date) = convert(date, @date)
							ORDER BY Date" onselected="SqlDataSource1_Selected">
			<SelectParameters>
				<asp:QueryStringParameter QueryStringField="date" Name="date" />
			</SelectParameters>
		</asp:SqlDataSource>
		<asp:Label ID="lblMessage" runat="server" />
	</asp:Panel>
	<br />           
	<hr />
	
	<div class="alignCenter">               
		<asp:Button ID="backBtn" Text="חזור" runat="server" onclick="backBtn_Click" CssClass="button"/>
	</div>
</asp:Content>
